package com.mvc.base.service;

import java.util.List;

import org.springframework.stereotype.Service;

import com.mvc.base.model.UserNotice;
import com.mvc.framework.service.BaseService;

@Service
public class UserNoticeManager extends BaseService<UserNotice, Integer> {
	public List<UserNotice> getUserCompanyByUserId(Integer userId) {
		UserNotice userCompanyPrivilege = new UserNotice();
		userCompanyPrivilege.setUserId(userId);
		return getHibernateTemplate().findByExample(userCompanyPrivilege);
	}

	public void saveUserNotices(List<UserNotice> companyPrivileges, Integer userId) {
		deleteByWhere("userId=" + userId);
		for (UserNotice companyPrivilege : companyPrivileges) {
			save(companyPrivilege);
		}
	}

}
